package edu.mama.college.mapper;

import edu.mama.college.model.Carousel;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 轮播图的MyBatis操作接口
 */
@Mapper
@Repository(value ="CarouselMapper")
public interface CarouselMapper {

    /**
     * 获取轮播图列表
     * @return
     */
    @Select("SELECT * from carousel order by sort asc")
    List<Carousel> getCarousels();

    /**
     * 删除全部轮播图
     */
    @Select("DELETE FROM carousel")
    void delete();

    /**
     * 批量插入轮播图
     */
    void createCarousels(List<Carousel> carouselList);
}
